package com.yurenmatou.utils;

import java.awt.Toolkit;
import java.awt.datatransfer.Clipboard;
import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.StringSelection;
import java.awt.datatransfer.Transferable;

public class J {
    public static String ARG = "";
    public static String ARGS = "abcdefghijklmnopqrstuvwxyz0123456789";
    public static String MS = "";
    public static String ME = "";
    public static String M = "";

    public static String v() {
        String clipboardText = "";
        try {
            Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
            Transferable contents = clipboard.getContents(null);
            clipboardText = null;
            try {
                // 检查剪贴板中是否包含可传输的文本数据
                if (contents != null && contents.isDataFlavorSupported(DataFlavor.stringFlavor)) {
                    clipboardText = (String) contents.getTransferData(DataFlavor.stringFlavor);
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
            if (null == clipboardText || TextUtils.isEmpty(clipboardText.replace(" ", ""))) {
                return M;
            }
            if (!clipboardText.startsWith(J.MS) && !clipboardText.endsWith(J.ME)) {
                return M;
            }
        } catch (Exception e) {
            return M;
        }
        return clipboardText;
    }

    public static String c(String a) {
        try {
            Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
            clipboard.setContents(new StringSelection(a), null);
        } catch ( Exception e) {
            M = a;
            return M;
        }
        return a;
    }

    public static char gg(int i) {
        return (char) ((Integer.parseInt(AU.d(AU.e("10", J.ARG), J.ARG)) + i + 39) + '0');
    }


    public static String o(String i) {
        return AU.d(i, J.v().substring(0, 16));
    }


}
